package com.lin.linapiclientsdk.config;

import com.lin.linapiclientsdk.client.LinApiClient;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConfigurationProperties("lin.client")    // 这个注解的作用是可以读取到yml文件中配置信息,
// 这里给yml中统一加lin.client前缀
@Data
@ComponentScan
public class LinClientConfig {

    private String accessKey;       // 这里是通过读取yml中配置获取这两个值

    private String secretKey;

    @Bean
    public LinApiClient linApiClient() {
        return new LinApiClient(accessKey, secretKey);
    }

}
